feat(proxy): durable http bridge ownership#250
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
2e98ed6 to
8fb2e2c
Compare
|
@codex review |
|
@Soju06 this change is important because the HTTP responses bridge was previously only “locally correct” inside a single worker’s memory, but not durable across the cases that matter in production: worker restarts, PID reuse, replica routing, reconnect handoff, and stale signed The painful part was that this behavior sits at the intersection of several different state machines:
Every time one path was fixed, another adjacent path exposed an assumption that had previously been “accidentally working.” A good example is that recovering a stale signed turn-state, preserving reconnect lease handoff, and keeping creation-time lease persistence overridable all sound like separate problems, but they were actually coupled through the same bridge lifecycle. That is why the review cycle felt endless: most follow-up fixes were not random bugs, they were hidden invariants being surfaced one by one. In practice, the hardest parts were:
So yes, this was a pain, but it was the necessary kind of pain. The branch is not just adding edge-case handling; it is forcing the bridge to have a consistent contract around ownership, recovery, and continuity loss. Without that, the failures stay nondeterministic and show up as “sometimes wrong instance,” “sometimes previous_response_not_found,” or “sometimes reconnect lost the bridge,” which is much worse to operate. If we keep iterating in this area after this PR, the next worthwhile cleanup would be to split |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Why
HTTP bridge turn-state continuity currently depends on an in-memory alias map. When a proxy process restarts, evicts a session, or a replayed request lands on another replica, the proxy can only observe that the local alias is missing. That collapses distinct situations into the same failure shape and can report the wrong error even when the original bridge is already gone.
This feature makes HTTP bridge ownership durable across restarts and replica boundaries so the proxy can tell the difference between:
Without that distinction, valid replays can fail after eviction or restart, while real ownership conflicts are indistinguishable from missing local state.
What Changed
Validation